﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
using System.Web.Http;

namespace LightSwitchApplication
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            ///'System.Web.Routing.SignalRRouteExtensions.MapHubs(System.Web.Routing.RouteCollection, Microsoft.AspNet.SignalR.HubConfiguration)' is obsolete: 
            ///'Use IAppBuilder.MapSignalR in an Owin Startup class.
            /*var config = new Microsoft.AspNet.SignalR.HubConfiguration
            {
                //EnableCrossDomain = true
            };
            RouteTable.Routes.MapHubs(config);
            //RouteTable.Routes.MapConnection<ChatConnection>("Chat", "chat/{operation}");
            */

            RouteTable.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = System.Web.Http.RouteParameter.Optional }
            );

        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}